/*
* MIT License
*
* Copyright (c) 2017 wen.gu <454727014@qq.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

/***************************************************************************
* Name: vos_log.h
*
* Purpose: virtual os virtual log interface define
*
* Developer:
*   wen.gu , 2018-08-08
*
* TODO:
*
***************************************************************************/

#ifndef __VOS_LOG_H__
#define __VOS_LOG_H__

#include "general_type.h"


/***************************************************************************
*
* macro declaration
*
***************************************************************************/
/** log macro */
#ifndef LOG_TAG
#define LOG_TAG "none" 
#endif

#ifndef LOGE 
#define LOGE(param, ...) VLOG(VL_LevelError, "ERR", param, ##__VA_ARGS__)
#endif

#ifndef LOGI
#define LOGI(param, ...) VLOG(VL_LevelInfo, "INF", param, ##__VA_ARGS__)
#endif

#ifndef LOGD
#define LOGD(param, ...) VLOG(VL_LevelDebug, "DBG", param, ##__VA_ARGS__)
#endif

#ifndef LOGW
#define LOGW(param, ...) VLOG(VL_LevelWarning, "WRN", param, ##__VA_ARGS__)
#endif

#ifndef VLOG
/**%s[%s][%s][%s.%d][%s]: timestamp, module, sub module, func, line, log type */
/** type: short string for debug level */
#define VLOG(level, type, param, ...) \
    vosLogPrint(level, LOG_TAG, __FUNCTION__, __LINE__, type, param, ##__VA_ARGS__)

#endif
/***************************************************************************
*
* data struct declaration
*
***************************************************************************/
typedef enum _eVosLogLevel
{/**VL: vos log */
    VL_LevelError = 0,
    VL_LevelWarning,
    VL_LevelInfo,
    VL_LevelDebug,
}eVosLogLevel;

typedef void(*vosLogCallbackFunc_t)(eVosLogLevel level, /** log level */
                                    const char* prefix, /** the prefix of log */
                                    const char* logstr  /** the content of log */);
/***************************************************************************
*
* API declaration
*
***************************************************************************/
/** type: log type */
G_API void vosLogPrint(eVosLogLevel vll, const char* tag,
                       const char* func, int line, const char* type,
                       const char* fmt, ...);


G_API void vosLogSetLevel(eVosLogLevel vll);
G_API void vosLogSetModuleName(const char* name);
G_API void vosLogSetPrintCallback(vosLogCallbackFunc_t cb);

G_API void vosLogEnableTimestamp(GBOL enable);


G_API eVosLogLevel vosLogGetLevel();
G_API const char*  vosLogGetModuleName();





#endif /** !__VOS_LOG_H__*/